/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hotelsupplymanagement;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;


public  class CLSupply extends CLAdding
{
    
    public static void main(String args[]) throws IOException, InterruptedException
    {
        CLSupply CLS=new CLSupply();
        CLS.CLSupply1();

    }

    public void CLSupply1() throws IOException, InterruptedException
    {
        
	int ch=0;
	String s;
        ir=new InputStreamReader(System.in);
	br=new BufferedReader(ir);
        CLViewing clv=new CLViewing();


	System.out.println("<-----Welcome to Noodle House ------>");
	System.out.println("1.ADD MENU/PRODUCT");
	System.out.println("2.ADD INVENTORY");
	//System.out.println("3.MAKE PRODUCT");
        System.out.println("4.VIEW MENU/PRODUCT");
        System.out.println("5.VIEW INVENTORY ");
        System.out.println("6.START GUI");
        System.out.println("7.START Server Socket");
        System.out.println("---------------------------------");
	System.out.println("8. Exit");

       while(ch!=8)
	{
            System.out.print("\n");
            System.out.println("\n Enter your Choice : ");
            System.out.print("prompt>");
            ch=Integer.parseInt(br.readLine());
            if(ch>8||ch<1)
            {
                System.out.println("Check the input :");
            }

            if(ch==1)
            {
                s="y";
                while(s.equals("y")||s.equals("Y"))
                {
                    CLaddProduct();
                    System.out.print("\n ADD MENU/PRODUCT (y/n):");
                    s=br.readLine();
                }
            }

            if(ch==2)
            {
                s="y";
                while(s.equals("y")||s.equals("Y"))
                {
                    CLaddInventory();
                    System.out.print("\n ADD INVENTORY ITEM (y/n):");
                    s=br.readLine();
                }
            }

            if(ch==4)
            {
                clv.CLviewProducts();
                
            }
            
            if(ch==5)
            {
                clv.CLviewInventory();
                
            }

            if(ch==6)
            {
                s="y";
                while(s.equals("y")||s.equals("Y"))
                {
                    Guisupply g=new Guisupply();
                    System.out.print("\n Enter Menu :");
                    ch=Integer.parseInt(br.readLine());
                    s="n";
                }
                

            }

            if(ch==7)
            {
                ServerSocket sersoc =new ServerSocket(5555);
                System.out.println("Server Socket Started .... ");
                sersoc.accept();
                sersoc.wait(1000);
                sersoc.close();
                System.out.println("Server Socket Closed .... ");

            }
        }
        System.out.println("=====Thanks====");
    }
}